/*************************************
 * Joe Helgeson
 * CS362 Assignment 3
 * Unit tests for various 
 * non-card-specific functions
 *
 * unittest3.c test for whoseTurn()
 ************************************/

#include "dominion.h"
#include "dominion_helpers.h"
#include "rngs.h"
#include <stdio.h>
#include <math.h>
#include <stdlib.h>
#include <assert.h>
#include <time.h>

//enabling debugging messages to appear
//#ifdef DEBUG
//#undef DEBUG
//#endif
//#define DEBUG 1

void testIt(struct gameState* tState);

///////////////////////////////////////
int main(int argc, char const** argv) {
	struct gameState* tState = malloc(sizeof(struct gameState));
	srand(time(NULL));	//init random seed
	testIt(tState);
	free(tState);
	return 0;
}

///////////////////////////////////////
void testIt(struct gameState* tState) {

	int t; 	//test number
	for(t=0; t<50; t++) {
		//setup
		int rPlyr = rand() % 4; 	//pick a random player
		tState->whoseTurn = rPlyr;		

		//compare output of whoseTurn()
		int res = whoseTurn(tState);

		if(res == rPlyr) {
			printf("Test Passed when Player set to #%d.\n", rPlyr);
		}
		else {
			printf("Test Failed when Player set to #%d.\n", rPlyr);
		}
	}
	printf("Unit test for whoseTurn() passed.\n");
	return;
}
